

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
        <title>Edit Avaliacao</title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLinkTo(dir:'')}">Home</a></span>
            <span class="menuButton"><g:link class="list" action="list">Avaliacao List</g:link></span>
            <span class="menuButton"><g:link class="create" action="create">New Avaliacao</g:link></span>
        </div>
        <div class="body">
            <h1>Edit Avaliacao</h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${avaliacao}">
            <div class="errors">
                <g:renderErrors bean="${avaliacao}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <input type="hidden" name="id" value="${avaliacao?.id}" />
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="area">Area:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:avaliacao,field:'area','errors')}">
                                    <g:select optionKey="id" from="${AreaAvaliacao.list()}" name="area.id" value="${avaliacao?.area?.id}" ></g:select>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="dataAtualizacao">Data Atualizacao:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:avaliacao,field:'dataAtualizacao','errors')}">
                                    <g:datePicker name="dataAtualizacao" value="${avaliacao?.dataAtualizacao}" ></g:datePicker>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="nome">Nome:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:avaliacao,field:'nome','errors')}">
                                    <input type="text" id="nome" name="nome" value="${fieldValue(bean:avaliacao,field:'nome')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="observacoes">Observacoes:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:avaliacao,field:'observacoes','errors')}">
                                    <input type="text" id="observacoes" name="observacoes" value="${fieldValue(bean:avaliacao,field:'observacoes')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="perguntas">Perguntas:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:avaliacao,field:'perguntas','errors')}">
                                    
<ul>
<g:each var="p" in="${avaliacao?.perguntas?}">
    <li><g:link controller="pergunta" action="show" id="${p.id}">${p?.encodeAsHTML()}</g:link></li>
</g:each>
</ul>
<g:link controller="pergunta" params="['avaliacao.id':avaliacao?.id]" action="create">Add Pergunta</g:link>

                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="situacao">Situacao:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:avaliacao,field:'situacao','errors')}">
                                    <g:checkBox name="situacao" value="${avaliacao?.situacao}" ></g:checkBox>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="unidade">Unidade:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:avaliacao,field:'unidade','errors')}">
                                    <g:select optionKey="id" from="${Unidade.list()}" name="unidade.id" value="${avaliacao?.unidade?.id}" ></g:select>
                                </td>
                            </tr> 
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" value="Update" /></span>
                    <span class="button"><g:actionSubmit class="delete" onclick="return confirm('Are you sure?');" value="Delete" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
